package math

import (
	"lesson01/instructions/base"
	"lesson01/rtda"
)

type DMul struct {
	base.NoOperandsInstruction
}

func (e *DMul) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	v2 := stack.PopDouble()
	v1 := stack.PopDouble()
	result := v2 * v1
	stack.PushDouble(result)
}

type FMul struct {
	base.NoOperandsInstruction
}

func (e *FMul) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	v2 := stack.PopFloat()
	v1 := stack.PopFloat()
	result := v2 * v1
	stack.PushFloat(result)
}

type IMul struct {
	base.NoOperandsInstruction
}

func (e *IMul) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	v2 := stack.PopInt()
	v1 := stack.PopInt()
	result := v2 * v1
	stack.PushInt(result)
}

type LMul struct {
	base.NoOperandsInstruction
}

func (e *LMul) Execute(frame *rtda.Frame) {
	stack := frame.OperandStack()
	v2 := stack.PopLong()
	v1 := stack.PopLong()
	result := v2 * v1
	stack.PushLong(result)
}
